home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 52
/
Amiga Format AFCD52 (Issue 136, May 2000).iso
/
-screenplay-
/
hd_installers
/
-whdload-
/
whdload_dev
/
src
/
macros
/
mulu32.i
next >
Wrap
Text File
|
2000-02-28
|
1KB
|
82 lines
IFND MULU32_I
MULU32_I=1
;----------------------------------------
; Multipliziert zwei 32-Bit Zahlen
; Übergabe : 1. Quelle 1
; 2. Ergebnis H
; 3. Quelle 2 = Ergebnis L
mulu32 MACRO
IFND CPU
FAIL Symbol CPU must defined for macro "mulu32.i" (i.e. CPU=68020)
ENDIF
IFNE NARG-3
IFNE NARG-2
FAIL bad amount of args to macro "mulu32" (i.e. "Mulu32 d1,d2,d3" or "Mulu32 d1,d2")
ENDC
ENDC
IFPL CPU-68020
IFEQ NARG-2
mulu.l \1,\2
ELSE
mulu.l \1,\2:\3
ENDC
ELSE
IFEQ NARG-2
;\1 Quelle 1
;\2 Quelle 2
;\2 Ergebnis
move.l \2,-(a7)
mulu \1,\2 ;LOW1 * LOW2
move.l \2,-(a7)
swap \1
move.w (6,a7),\2
mulu \1,\2 ;HIGH1 * LOW2
add.w \2,(a7)
swap \1
move.w (4,a7),\2
mulu.w \1,\2 ;LOW1 * HIGH2
swap \2
add.l (a7)+,\2
addq.l #4,a7 ;(OVERFLOW & CARRY are not set correctly !!!)
ELSE
;\1 Quelle 1
;\3 Quelle 2
;\2 Ergebnis High
;\3 Ergebnis Low
move.w \1,\2 ;1. MULU (beide Low-Teile)
mulu.w \3,\2
move.l \2,-(a7) ;-> ELH\@
move.l \1,\2 ;2. MULU (beide High-Teile)
swap \2
swap \3 ;Q2 swapped
mulu.w \3,\2
move.l \2,-(a7) ;-> EHH\@
move.w \1,\2 ;3. MULU (Low und High-Teil)
mulu.w \3,\2
add.l \2,(2,a7)
bcc.b .skip1\@
addq.w #1,(a7)
.skip1\@
move.l \1,\2 ;4. MULU (High und Low-Teil)
swap \2
swap \3
mulu.w \3,\2
add.l \2,(2,a7)
bcc.b .skip2\@
addq.w #1,(a7)
.skip2\@
move.l (a7)+,\2
move.l (a7)+,\3
ENDC
ENDC
ENDM
ENDC